<?php

/**
 * [复制目录]
 * @param [type] $dir   [description]
 * @param [type] $toDir [description]
 */
function cop($dir,$toDir){

	if (!is_dir($toDir)) {

		mkdir($toDir,0755,true);

	}else{

		return;
	}

	foreach (glob($dir.'/*') as $value) {
		
		$file = $toDir.'/'.basename($value);

		if (is_file($value)) {

			copy($value, $file);

		}else{

			mkdir($file,0755,true);

			cop($value, $file);
		}
		
	}

}

cop('a','houdunwang');



?>